/**
 * @file overwrite FSError
 */
class MemoryFsError extends Error {
  constructor (err, path, operation) {
    super(err, path)
    this.name = this.constructor.name
    const message = [`${err.code}:`, `${err.description},`]
    if (operation) {
      message.push(operation)
    }
    message.push(`'${path}'`)
    this.message = message.join(' ')

    this.code = err.code
    this.errno = err.errno
    this.path = path
    this.operation = operation
    if (Error.captureStackTrace) {
      Error.captureStackTrace(this, this.constructor)
    }
  }
}

export default MemoryFsError
